﻿<Window x:Class="Mengsk.ProxyDelivery.App.UI.Delivery.DeliveryTemplateEditWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        Title="运费模板编辑" Height="600" Width="850" Loaded="MetroWindow_Loaded" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <sys:String  x:Key="Edit">编辑</sys:String>
        <sys:String  x:Key="Delete">删除</sys:String>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="3">
            <TextBlock Text="模板类型:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Margin="3" VerticalAlignment="Center" Width="60" Name="cbbType"/>
            <TextBlock Text="模板名称：" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbName" Margin="3" VerticalAlignment="Center" Width="120"/>
            <TextBlock Text="物流公司：" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Name="cbbDeliveryCompanies" VerticalAlignment="Center" Width="120"/>
            <TextBox Text="面单金额：" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbPaperMoney" VerticalAlignment="Center" Width="60"/>
            <Button Name="btnAddArea" Content="添加运费条目" Margin="3" VerticalAlignment="Center" Width="100" HorizontalAlignment="Right" Click="btnAddArea_Click"/>
            <Button Name="btnSave" Content="保存" Width="80" Margin="3" Click="btnSave_Click" VerticalAlignment="Center"/>
        </StackPanel>

        <DataGrid Grid.Row="1" Name="dgvAreas" AutoGenerateColumns="False" CanUserAddRows="False" GridLinesVisibility="All" CanUserDeleteRows="False" SelectionMode="Single" SelectionUnit="FullRow">
            <DataGrid.Columns>
                <DataGridTextColumn Header="目地城市" Binding="{Binding Path=Source.Area}" Width="*" IsReadOnly="True"/>
                <DataGridTextColumn Header="首重" Binding="{Binding Path=Source.Start}" Width="Auto"/>
                <DataGridTextColumn Header="首重运费" Binding="{Binding Path=Source.StartPrice}" Width="Auto"/>
                <DataGridTextColumn Header="续重" Binding="{Binding Path=Source.Step}" Width="Auto"/>
                <DataGridTextColumn Header="续重运费" Binding="{Binding Path=Source.StepPrice}" Width="Auto"/>
                <DataGridHyperlinkColumn Header="编辑" Binding="{Binding Edit}" Width="Auto" IsReadOnly="True">
                    <DataGridHyperlinkColumn.ElementStyle>
                        <Style>
                            <EventSetter Event="Hyperlink.Click" Handler="Edit_Click"/>
                        </Style>
                    </DataGridHyperlinkColumn.ElementStyle>
                </DataGridHyperlinkColumn>

                <DataGridHyperlinkColumn Header="删除" Binding="{Binding Delete}" Width="Auto" IsReadOnly="True">
                    <DataGridHyperlinkColumn.ElementStyle>
                        <Style>
                            <EventSetter Event="Hyperlink.Click" Handler="Delete_Click"/>
                        </Style>
                    </DataGridHyperlinkColumn.ElementStyle>
                </DataGridHyperlinkColumn>
            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</Window>
